<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/common.jsp" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>修改用户</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="修改,用户">
	<meta http-equiv="description" content="This is my page">

  </head>
  
  <body>
    <center>
    	<s:form name="frm" id="frm" method="post" action="" namespace="">
    		<jsp:include page="/jsp/outward/business/common/menuLink.jsp">
    			<jsp:param name="menuLink" value="[{'name':'系统管理'},{'name':'用户管理'},{'name':'修改用户'}]"/>
    			<jsp:param name="width" value="70%"/>
    		</jsp:include>
    		
    		<s:hidden name="user.id"></s:hidden>
    		<table width="100%" cellspacing="1" cellpadding="3" bgcolor="#CCCCCC">
    			<tr bgcolor="#FFFFFF">
    				<td width="15%" align="right" class="label">
    					用户帐号：
    				</td>
    				<td width="35%" align="left">
    					<s:property value="user.id" />
    				</td>
    				<td width="15%" align="right" class="label">
    					用户名称：
    					<br>
    					<font color="red">(20字以内)</font>
    				</td>
    				<td width="35%" align="left">
    					<s:textfield name="user.username" id="username" cssStyle="width:80%" maxlength="20"></s:textfield>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					性别：
    				</td>
    				<td align="left">
    					<s:select list='#{"男":"男", "女":"女"}' cssStyle="width:120" name="user.sex" id="sex"></s:select>
    				</td>
    				<td align="right" class="label">
    					所属部门：
    				</td>
    				<td align="left">
    					<s:select list="deptList" listKey="id" listValue="deptName" headerKey="" headerValue="--请选择--" cssStyle="width:120" name="user.dept.id" id="deptId"></s:select>
    				</td>
    			</tr>
    			<tr bgcolor="#FFFFFF">
    				<td align="right" class="label">
    					使用情况：
    				</td>
    				<td align="left" colspan="3">
    					<s:radio list='#{"use":"已审核", "lock":"已锁定"}' name="user.useType" id="useType" value="user.useType"></s:radio>
    				</td>
    			</tr>
    		</table>
    		
    		<table width="100%" cellspacing="0">
    			<tr>
    				<td align="center" valign="bottom" height="30">
    					<input type="button" value="修改" class="btn" onclick="updateUser()" />
    				</td>
    			</tr>
    		</table>
    		
    		
    	</s:form>
    </center>
    
    <script type="text/javascript">
    function updateUser()
    {
    	var username = $('#username');
    	var deptId = $('#deptId');
    	if('' == username.val().Trim())
    	{
    		showMsg('用户名称不能为空。', function(){username.focus();});
    		return;
    	}
    	if('' == deptId.val().Trim())
    	{
    		showMsg('部门不能为空。', function(){deptId.focus();});
    		return;
    	}
    	$.ajax({
    		url:'${CONTEXT_PATH}/inner/user/updateUser.action',
    		type:'post',
    		data:$("#frm").serialize(),
    		success:
    			function(result){
    				showMsg('修改成功。', function(){
    					var parentMethod = '<s:property value='parentMethod' />';
    					if('NO' != parentMethod)
    					{
			    			window.opener.searchThis();
			    		}
			    		window.close();
			    	});
    			}
    	});
    }
    </script>
  </body>
</html>
